package PatternOfDesign.Singleton;

/**
 * Created by Ghost on 2014/11/1.
 */
public class Singleton {


    private Singleton() {//私有构造方法，防止该类被实例化。

    }

    public static class SingletonFactory{
        public static Singleton instance = new Singleton();
    }

    public static Singleton getInstance(){
        return SingletonFactory.instance;
    }
    public static void main(String[] args){
        Singleton singleton = Singleton.getInstance();
        Singleton singleton1 = Singleton.getInstance();
    }
}
